HAL DTS I/O operation functions

This section provides information about the HAL DTS I/O operation functions migration.

Process Polling

HAL DTS start measurement

HAL1

HAL2

Function prototype

HAL_StatusTypeDef HAL_DTS_Start(DTS_HandleTypeDef *hdts);
hal_status_t HAL_DTS_StartSensor(hal_dts_handle_t *hdts,
                                 hal_dts_sensor_t sensor);

Example usage

DTS_HandleTypeDef hdts;
HAL_DTS_Start(&hdts);
hal_dts_handle_t hDTS;
HAL_DTS_StartSensor(&hDTS, HAL_DTS_SENSOR_1);

HAL DTS stop measurement

HAL1

HAL2

Function prototype

HAL_StatusTypeDef HAL_DTS_Stop(DTS_HandleTypeDef *hdts);
hal_status_t HAL_DTS_StopSensor(hal_dts_handle_t *hdts,
                                hal_dts_sensor_t sensor);

Example usage

DTS_HandleTypeDef hdts;
HAL_DTS_Stop(&hdts);
hal_dts_handle_t hDTS;
HAL_DTS_StopSensor(&hDTS, HAL_DTS_SENSOR_1);

Process IT

HAL DTS start measurement IT

HAL1

HAL2

In HAL1, the HAL_DTS_Start_IT function enable all 3 sensors ITs internally.

The enabled ITs are (according to the user chosen clock source): HAL DTS interrupt definitions

In HAL2, the HAL_DTS_StartSensor_IT function only enable the end of measurement IT for the specified sensor. If you need to active the High/Low threshold you can use HAL_DTS_StartSensor_IT_Opt function.

Function prototype

HAL_StatusTypeDef HAL_DTS_Start_IT(DTS_HandleTypeDef *hdts);
hal_status_t HAL_DTS_StartSensor_IT(hal_dts_handle_t *hdts,
                                    hal_dts_sensor_t sensor);
hal_status_t HAL_DTS_StartSensor_IT_Opt(hal_dts_handle_t *hdts,
                                        hal_dts_sensor_t sensor,
                                        uint32_t interrupts)

Example usage

HAL_DTS_Start_IT(&hdts);
HAL_DTS_StartSensor_IT(&hDTS, HAL_DTS_SENSOR_1);
HAL_DTS_StartSensor_IT_Opt(&hDTS, HAL_DTS_SENSOR_1,
                            HAL_DTS_OPT_IT_LOW_THRESHOLD | HAL_DTS_OPT_IT_HIGH_THRESHOLD);

HAL DTS stop measurement IT

HAL1

HAL2

Function prototype

HAL_StatusTypeDef HAL_DTS_Stop_IT(DTS_HandleTypeDef *hdts);
hal_status_t HAL_DTS_StopSensor_IT(hal_dts_handle_t *hdts,
                                  hal_dts_sensor_t sensor);

Example usage

HAL_DTS_Stop_IT(&hdts);
HAL_DTS_StopSensor_IT(&hDTS, HAL_DTS_SENSOR_1);

HAL DTS get temperature

HAL1

HAL2

Function prototype

HAL_StatusTypeDef HAL_DTS_GetTemperature(DTS_HandleTypeDef *hdts,
                                         int32_t *Temperature);
hal_status_t HAL_DTS_GetSensorTemperature(const hal_dts_handle_t *hdts,
                                          hal_dts_sensor_t sensor,
                                          int32_t *p_temperature_degc);

Example usage

int32_t temperature1;
HAL_DTS_GetTemperature(&hdts, &temperature1);
int32_t temperature1;
HAL_DTS_GetSensorTemperature(&hDTS, HAL_DTS_SENSOR_1, &temperature1);

HAL DTS IRQHandler function

HAL1

HAL2

void HAL_DTS_IRQHandler(DTS_HandleTypeDef *hdts);
void HAL_DTS_IRQHandler(hal_dts_handle_t *hdts);

HAL DTS state retrieval

HAL1

HAL2

HAL_DTS_StateTypeDef HAL_DTS_GetState(DTS_HandleTypeDef *hdts);
hal_dts_state_t HAL_DTS_GetState(const hal_dts_handle_t *hdts);